﻿<phone:PhoneApplicationPage 
    x:Class="WinMilk.Gui.EditTaskPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:progress="clr-namespace:WinMilk.Gui.Controls.ProgressBar"
    xmlns:con="clr-namespace:WinMilk.Gui.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    con:TiltEffect.IsTiltEnabled="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="170" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Path=Loc.AppNameCaps, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="{Binding Path=Loc.EditTaskTitle, Source={StaticResource L10N}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>
        <ScrollViewer x:Name="scrollViewer" Margin="12,0,12,0" Grid.Row="1">
            <StackPanel x:Name="ContentPanel">

                <!-- Name -->
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock x:Name="textBlock" Text="{Binding Path=Loc.AddTaskName, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Top" Margin="13,15,0,0" Grid.Column="0" />
                    <TextBox x:Name="TaskName" Grid.Column="1" InputScope="Text"/>
                </Grid>

                <!-- Due Date -->
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="{Binding Path=Loc.AddTaskDue, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Top" Margin="13,15,0,0" />

                    <StackPanel Grid.Column="1">
                        <StackPanel Orientation="Horizontal">
                            <RadioButton Name="NoDueRadio" IsChecked="True" Checked="NoDueRadio_Checked">
                                <TextBlock Text="{Binding Path=Loc.AddTaskDueNever, Source={StaticResource L10N}}"/>
                            </RadioButton>
                            <RadioButton Name="DueDayRadio" Checked="DueDayRadio_Checked">
                                <TextBlock Text="{Binding Path=Loc.AddTaskDueDay, Source={StaticResource L10N}}"/>
                            </RadioButton>
                            <RadioButton Name="DueTimeRadio" Checked="DueTimeRadio_Checked">
                                <TextBlock Text="{Binding Path=Loc.AddTaskDueTime, Source={StaticResource L10N}}"/>
                            </RadioButton>
                        </StackPanel>
                        <toolkit:DatePicker Name="TaskDueDateNoTime" Visibility="Collapsed"/>
                        <Grid Name="TaskDueDateTime" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <toolkit:DatePicker Name="TaskDueDate" Grid.Column="0" />
                            <toolkit:TimePicker Name="TaskDueTime" Grid.Column="1" />
                        </Grid>
                    </StackPanel>
                </Grid>

                <!-- List -->
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="{Binding Path=Loc.AddTaskList, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Top" Grid.Column="0" Margin="13,15,0,0"/>
                    <toolkit:ListPicker x:Name="TaskList" Grid.Column="1" ItemsSource="{Binding TaskLists}" FullModeHeader="{Binding Path=Loc.AddTaskList, Source={StaticResource L10N}}">
                        <toolkit:ListPicker.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}" />
                            </DataTemplate>
                        </toolkit:ListPicker.ItemTemplate>

                        <toolkit:ListPicker.FullModeItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                            </DataTemplate>
                        </toolkit:ListPicker.FullModeItemTemplate>
                    </toolkit:ListPicker>
                </Grid>

                <!-- Tags -->
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding Path=Loc.AddTaskTags, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Top" Grid.Column="0" Margin="13,15,0,0"/>
                    <TextBox x:Name="TaskTags" Grid.Column="1" InputScope="Text"/>
                </Grid>

                <!-- Priority -->
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="80" />
                        <RowDefinition Height="80" />
                    </Grid.RowDefinitions>

                    <TextBlock Text="{Binding Path=Loc.AddTaskPriority, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Center" Grid.Row="0"/>
                    <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
                        <RadioButton Name="TaskPriority1">
                            <Grid>
                                <Rectangle Fill="#EA5200" Width="40" Height="40"/>
                                <TextBlock Text="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                        </RadioButton>
                        <RadioButton Name="TaskPriority2">
                            <Grid>
                                <Rectangle Fill="#0060BF" Width="40" Height="40"/>
                                <TextBlock Text="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                        </RadioButton>
                        <RadioButton Name="TaskPriority3">
                            <Grid>
                                <Rectangle Fill="#359AFF" Width="40" Height="40"/>
                                <TextBlock Text="3" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                        </RadioButton>
                        <RadioButton Name="TaskPriorityNone" IsChecked="True">
                            <TextBlock Text="{Binding Path=Loc.AddTaskPriorityNone, Source={StaticResource L10N}}" />
                        </RadioButton>
                    </StackPanel>
                </Grid>

            </StackPanel>

        </ScrollViewer>

        <ProgressBar IsIndeterminate="{Binding IsLoading}" 
                 Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}" 
                 Height="10" 
                 VerticalAlignment="Top" 
                 Margin="0,137,0,0" 
                 Style="{StaticResource PerformanceProgressBar}"/>

    </Grid>

</phone:PhoneApplicationPage>
